<?php

include_once("../config.php");
include_once("functii.php");

echo '<p align="center"><em>Nivelul de energie</em></p>';
 
$energie = mysql_result(mysql_query("SELECT energie FROM `planete` WHERE user = '$user' AND id = '$planeta'"), 0);
$nivel_maxim = '20000';

$procent = (round($energie, -1)*100)/$nivel_maxim;
if ($procent > 100) {
 $procent = 100;
 $imagine = "nivel_good";
 $status = "Nivel maxim";
}
if ($procent <= 0) { 
  $procent = 0; 
  $imagine = "nivel_bad";
  $status = "Toate sistemele sunt oprite"; }
if ($procent >= 50 && $procent < 100) {
 $imagine = "nivel_good"; 
 $status =  "Nivel excelent"; }
elseif($procent > 0 && $procent <= 20) {
 $imagine = "nivel_bad"; 
 $status = "Nivel critic"; }
elseif($procent > 20 && $procent < 50) {
 $imagine = "nivel_ok"; 
 $status = "Nivel optim"; }
 
echo '<div style="float:left">'.$procent.'%</div><div style="float:left; width:135px; height:10px; background-image:url(img/dot.png)"><img src="img/'.$imagine.'.gif" width="'.$procent.'%" height="9" align="middle"></div><br>';
echo '<div>'.$status.'</div>';

?>